package edu.fdzc.learn.service.impl;

import edu.fdzc.learn.entity.Lesson;
import edu.fdzc.learn.mapper.LessonsMapper;
import edu.fdzc.learn.service.LessonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LessonServiceImpl implements LessonService {

    @Autowired
    private LessonsMapper lessonsMapper;

    @Override
    public void add(Lesson lesson) {
        lessonsMapper.insert(lesson);
    }

    @Override
    public void update(Lesson lesson) {
        lessonsMapper.update(lesson);
    }

    @Override
    public void deleteById(int id) {
        lessonsMapper.delete(id);
    }

    @Override
    public Lesson findById(int id) {
        return lessonsMapper.findById(id);
    }

    @Override
    public List<Lesson> findByCourseId(int courseId) {
        return lessonsMapper.fingByCourseId(courseId);
    }

    @Override
    public List<Lesson> getall() {
        return lessonsMapper.getall();
    }
}
